home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16543 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  845 b 

  1. From: ChrisHines@msn.com (Chris Hines)
  2. Subject: Re: Arrays or Pointers?
  3. Date: 11 Apr 96 05:24:13 -0700
  4. References: <4kbsk3$f07@zeus.tcp.co.uk> <316AB218.167E@rchland.ibm.com>
  5. Message-ID: <00001a81+0000b1d4@msn.com>
  6. Path: news.msn.com!msn.com
  7. Newsgroups: comp.lang.c++
  8. Organization: The Microsoft Network (msn.com)
  9.  
  10. David wrote:
  11. > I'm currently on a C++ course and we seem to be using pointers a fair
  12. > bit. On questioning this, was told that pointers where quicker than
  13. > using arrays. In which situations should I be using arrays over
  14. > pointers and vice versa?
  15.  
  16. Most optimizing compilers will turn loops over an array using a 
  17. simple index variable into virtually the same machine instructions as 
  18. a loop using pointers.  It all depends on how complicated the loop 
  19. is, and how good the compiler is.
  20.  
  21. -----
  22. Chris Hines            ChrisHines@msn.com
  23.